/**
 * @file user_events.c
 * @brief
 *
 * @author Mr.Lin (Email：61900302@qq.com)
 * @version 1.0
 * @date 2023-09-15
 *
 * @copyright Copyright (c) 2023 kangTuo Tech.co, Ltd
 *
 * @par 修改日志:
 * Date           Version     Author      Description
 * 2023-09-15     1.0         Mr.Lin      Init
 */
#include "user_events.h"
#include "mlog.h"
#include "ui.h"
#include "imath.h"
#include "dev_valve.h"
#include "user_bluetooth.h"
#include "interface.h"
#include "user_data.h"
#include "user_fault.h"
#include "fault.h"
#include "dev_ft6236.h"

/* 主机档位事件回调函数 */
static void lv_master_gear_event_cb(lv_event_t *e)
{
    lv_event_code_t code = lv_event_get_code(e);
    dbg("%s %d %d\r\n", __func__, __LINE__, code);
}


/* 开关机事件回调函数 */
static void lv_power_event_cb(lv_event_t *e)
{
    static uint16_t startup_cmd = 0;
    lv_event_code_t code = lv_event_get_code(e);
    dbg("%s %d %d\r\n", __func__, __LINE__, code);
}

/* 喇叭事件回调函数 */
static void  lv_speaker_event_cb(lv_event_t *e)
{
    static uint16_t cnt = 1;
    lv_event_code_t code = lv_event_get_code(e);
    dbg("%s %d %d\r\n", __func__, __LINE__, code);
}

/* 蓝牙事件回调函数 */
static void  lv_bluetooth_event_cb(lv_event_t *e)
{
    static uint16_t cnt = 1;
    lv_event_code_t code = lv_event_get_code(e);
    dbg("%s %d %d\r\n", __func__, __LINE__, code);
}

/* 添加switch和button事件 */
void lv_user_events_create(void)
{
    lv_obj_add_event_cb(ui_ImgButtonPowerOnOff, lv_power_event_cb, LV_EVENT_ALL, NULL);
    lv_obj_add_flag(ui_ImgButtonPowerOnOff, LV_OBJ_FLAG_CHECKABLE);
    lv_obj_add_event_cb(ui_ImgButtonMasterGear, lv_master_gear_event_cb, LV_EVENT_ALL, NULL);
    lv_obj_add_flag(ui_ImgButtonMasterGear, LV_OBJ_FLAG_CHECKABLE);
    lv_obj_add_event_cb(ui_ImgButtonSpeaker, lv_speaker_event_cb, LV_EVENT_ALL, NULL);
    lv_obj_add_flag(ui_ImgButtonMasterGear, LV_OBJ_FLAG_CHECKABLE);
    lv_obj_add_event_cb(ui_ImgButtonBluetoothOnOff, lv_bluetooth_event_cb, LV_EVENT_ALL, NULL);
    lv_obj_add_flag(ui_ImgButtonBluetoothOnOff, LV_OBJ_FLAG_CHECKABLE);
}



